ECE 563 Assignment 2

Read chapter 2 and chapter 3 (p. 104-138)

Do the following exercises, using published MATLAB. Include an index.html file identifying yourself and guiding the reader through your submission. Include all MATLAB code and images.

  1. Use MATLAB publishing to generate an HTML table of image characteristics for the images you used in the first assignment. The table should have columns for image number, filename, image size, camera type (if any), color type, and number of entries in color table (if any).

  2. Find the distance between points (120,15) and (92,85) using various distance metrics: Euclidian (2-norm), city block (1-norm), and chessboard (∞-norm). Read p 68–72 in textbook and my notes on pixel neighbors.

  3. Generate a grayscale image of the function sinc(x)^4 · sinc(y)^4 over the domain -10 < (x, y) < 10 and scale the pixel values logarithmically to show the secondary maxima (see example).

  4. Generate a noise image of random values taken from a uniform probability distribution for pixel values between 0 and 1. The image should be 128 x 128. Show a histogram of this image. Derive formulas for the mean and standard deviation of a uniform [0..1] random image. Compare these results to the measured mean and standard deviation for the uniform random image you generated.

  5. Calculate the entropy H of several grayscale images, including the uniform random image generated above. Entropy is defined as

    where M is the number of gray levels and pk is the probability associated with gray level k. Note that a base-2 logarithm is used conventionally. See the file entropy.m. Read p 532–533 of the textbook.

  6. Take a grayscale image and calculate its entropy. Now mask off successive bits, starting from the least significant and plot the entropy as a function of bits in the image. A bit mask of the upper 6 bits can be generated from
    	mask = uint8(hex2dec('fc'));
    	out = bitand(inp,mask);
    
    where inp is the input image and out is the output image. The input should be uint8. The sequence of masks should be hex 'fe' (7 bits), 'fc' (6 bits), 'f8' (5 bits), 'f0' (4 bits), etc. You might also try the masking in reverse order, which ties into the next exercise.

  7. Take a grayscale image and calculate the entropy associated with each bitplane. A bitplane is generated by masking with a single bit, e.g. hex '20'. Plot the entropy vs. bitplane index.


Maintained by John Loomis, last updated 23 Jan 2016